<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/tld/token.tld" prefix="token" %>

<div class="pop-background">
    <div class="col-md-5">
        <div class="popup popup5 popup-small x-4-move">
            <div class="panel-heading">
                <div class="panel-btns">
                    <a class="panel-close btn-4-hide">×</a>
                </div>
                <h3 class="panel-title">修改密码</h3>
            </div>
            <div class="panel-add-to">
                <div class="row">
                    <form>
                        <token:token/>
                        <div class="panel-body panel-body-ws">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">新密码：</label>

                                    <div class="col-sm-6">
                                        <input type="password" class="form-control" name="newPassword"
                                               autocomplete="off" value="">
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">确认密码：</label>

                                    <div class="col-sm-6">
                                        <input type="password" class="form-control confirmPassword" autocomplete="off"
                                               value="">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>

                <div class="btn-group2-s">
                    <div class="panel-body panel-body2">
                        <div class="btn-group2 left">
                            <button type="button" class="btn btn-primary btn-4-save">保存</button>
                            <button type="button" class="btn btn-default btn-4-hide">取消</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        $(document).ready(function () {

            $('#pop-wrapper .x-4-move').dragging({
                move: 'both',
                randomPosition: false,
                handler: '.panel-heading'
            });

            $('#pop-wrapper .btn-4-save').off('click').on('click', function () {
                var newPassword = $('#pop-wrapper input[name=newPassword]').val();
                var confirmPassword = $('#pop-wrapper input.confirmPassword').val();
                if (!newPassword) {
                    tipData({
                        status: 3,
                        message: '新密码不能为空'
                    });
                    return;
                }
                if (newPassword != confirmPassword) {
                    tipData({
                        status: 3,
                        message: '确认密码和密码不一致'
                    });
                    return;
                }
                ajaxSubmitResponseJSON({
                    url: 'manager/modifyPassword.htm',
                    method: 'POST',
                    data: $('#pop-wrapper form').serialize(),
                    success: function (data) {
                        if (data.status == 0) {
                            closeLayer();
                        }
                    }
                });
            });
        });
    </script>
</div>